/**
 * <p>Title: Input.java</p>
 * <p>Description: CS 343 Final Project. This class takes the input of the keys the user is pressing</p>
 * @author Tim Olmstead, Brady Fetting, Erik Brown, Thales Kirk
 * @email timothy.olmstead@my.uwrf.edu, brady.fetting@my.uwrf.edu, 
 * 			erik.brown@my.uwrf.edu, thales.kirk@my.uwrf.edu
 * @date November 15, 2013
 */
package Components;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import GameState.Game;

public class Input {
	KeyAdapter keys;


	// this will need to be an input class to keep the input separated from the
	// game engine
	/**
	 * @description Creates the reyReleased events for the controls
	 */
	public Input() {
		keys = new KeyAdapter() {
			public void keyReleased(KeyEvent ke) { // listeners for when keys
													// are released
				if (Game.player == null)
					return;
				switch (ke.getKeyCode()) {
				case KeyEvent.VK_LEFT:
					Game.player.stopX();
					break;
				case KeyEvent.VK_RIGHT:
					Game.player.stopX();
					break;
				case KeyEvent.VK_P:
					Game.pauseUnpause();
					break;
				default:
				}
			}

			public void keyPressed(KeyEvent ke) { // listeners for when keys are
													// pressed
				if (Game.player == null)
					return;
				switch (ke.getKeyCode()) {
				case KeyEvent.VK_LEFT:
					Game.player.left();
					break;
				case KeyEvent.VK_RIGHT:
					Game.player.right();
					break;
				case KeyEvent.VK_SPACE:
					Game.player.jump();
					break;
				default:
				}
			}
		};
	}
	/**
	 * @return keys
	 * @description returns the keys for use in other classes
	 */
	public KeyAdapter getKeys() {
		return keys;
	}
}
